package top.z.orm.handle.osql.core;

public class CacheDeleteThread extends Thread {

    private static boolean finished = true;

    private int delEndIndex;

    public CacheDeleteThread() {
    }

    public CacheDeleteThread(int delEndIndex) {
        this.delEndIndex = delEndIndex;
    }

    public CacheDeleteThread(String name) {
        super(name);
    }

    public void begin() {
//		try {
        if (finished) {
            finished = false;
//				new CacheDeleteThread("CacheDeleteThread start thread" + (num++)).start(); //不能再用new
//				this.setName("CacheDeleteThread" + (num++));
            this.start();
////				Logger.info("========in CacheDeleteThread==============" + Thread.currentThread().getName());
//				Logger.info("========in CacheDeleteThread==============" + this.getName());
        }
//		} catch (Exception e) {
//			Logger.error(e.getMessage());
//		}
    }

    @Override
    public void run() {
        CacheUtil.delCacheInBetween(delEndIndex);
        finished = true;
    }
}